package com.ecb.business.controller;

import com.ecb.business.dto.api.ApiResult;
import com.ecb.business.dto.user.UserDTO;
import com.ecb.business.dto.user.QueryUserDTO;
import com.ecb.business.service.UserManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("userManage")
@Api(tags = "用户管理")
public class UserManageController {

    @Autowired
    UserManageService userManageService;

    @GetMapping("getAllUser")
    @ApiOperation(value = "查询用户信息",notes = "")
    public ApiResult getAllUser(@RequestBody QueryUserDTO queryDTO){
        return ApiResult.T(userManageService.getAllUser(queryDTO));
    }

    @PostMapping("addUser")
    @ApiOperation(value = "用户注册",notes = "")
    public ApiResult addUser(@RequestBody UserDTO addDTO ){
        return ApiResult.T(userManageService.addUser(addDTO));
    }

    @PostMapping("updateUser")
    @ApiOperation(value = "用户信息更新",notes = "")
    public ApiResult updateUser(@RequestBody UserDTO userDTO ){
        return ApiResult.T(userManageService.updateUser(userDTO));
    }
    @PostMapping("deleteUser")
    @ApiOperation(value = "用户注销",notes = "")
    public ApiResult deleteUser(@RequestBody UserDTO userDTO  ){
        return ApiResult.T(userManageService.deleteUser(userDTO));
    }
}
